Release 10.1A: OpenEdge Deployment:
Managing 4GL Applications
Connection techniques
There are five ways to connect a database:
- As an argument when starting OpenEdge.
- With the
CONNECTstatement (in the Progress Procedure Editor or in a 4GL procedure).- With the OpenEdge Data Dictionary.
- With the OpenEdge Data Administration tool.
Note: Starting a server or broker for a database is distinct from connecting to a database. You must start a server or broker for a database before you can connect to the database in multi-user mode. For information about starting a server or broker, see OpenEdge Getting Started: Installation and Configuration .- Using the Auto-connect feature.
This section explains how to connect to databases using these various techniques. OpenEdge Development: Programming Interfaces explains why you might choose one technique instead of another.
Connecting at startup
You can connect to databases at session startup with one of the OpenEdge startup commands or with an application startup file. For example, the following
PROcommand starts a single-user session and connects to three databases:
Note: To retain compatibility with earlier versions, OpenEdge does not require you to specify the Database Name (-db) connection parameter for the first database on the command line.
If you specify more than one database when you start a session, it is important to specify the connection parameters for each database directly after the database name to which they apply, and before the next Database Name (-db) connection parameter. OpenEdge applies database connection parameters only to the previously specified database.
The following syntax example illustrates the correct location for database connection parameters:
You can specify all other parameters anywhere on the command line. If you specify the same parameter more than once, OpenEdge uses the value you specified for the last instance of the parameter.
You can also use a parameter file to specify database connection parameters. The following example shows a UNIX startup script for a client application. The last line invokes the
_progresexecutable:
The previous startup script sets up environment variables for an application and starts a Progress 4GL client application session using two parameter files called
parm1.pfandparm2.pf. Theparm1.pfparameter file contains the following entry:
The
parm2.pfparameter file contains the following entry:
This example illustrates a common approach to connecting multiple databases when you start OpenEdge using a parameter file for each database. Each parameter file is specified on the command line with the Parameter File (
-pf) startup parameter.Connecting from a procedure with the CONNECT statement
The
CONNECTstatement allows you to connect to a database from a 4GL procedure or from the Progress Procedure Editor.The following
CONNECTstatements connect the appldb1 database in single-user mode, the appldb2 database in multi-user mode, and the databases specified in the parameter file,parm3.pf(respectively):
Connecting with the
CONNECTstatement is very similar to connecting at startup. Although it is possible to connect to several databases within oneCONNECTstatement, it is a good idea to connect only one database perCONNECTstatement. A connection failure for one database causes a termination of the currentCONNECTstatement, leaving any subsequent database specified with theCONNECTstatement unconnected. For detailed information about theCONNECTstatement, see OpenEdge Development: Progress 4GL Reference and OpenEdge Development: Programming Interfaces .Connecting with the Data Dictionary
You can connect to a database during a Progress 4GL session using the graphical user interface of the Data Dictionary.
![]()
To connect to a database with the Data Dictionary:
- Open the Data Dictionary. The Data Dictionary main window appears:
![]()
- Choose Database
Connect. The Connect Database dialog box appears:
![]()
- Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
![]()
- Enter the following information, then choose OK:
- Physical Name — Specifies the actual name of the database on a disk.
- Logical Name — Specifies the database name that references a connected physical database.
- Database Type — Specifies the database type. The only possible value is PROGRESS.
- Network — Specifies the network type, if you are connecting to a network server. The only possible value is TCP.
- Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
- Host Name — Specifies the database server machine in a network environment.
- Service Name — Specifies the broker or server service name in a network environment.
- User ID — Identifies your user ID.
- Password — Identifies your password.
- Trigger Location — Identifies a directory or Progress 4GL procedure library where trigger code is stored.
- Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
- Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
OpenEdge returns you to the Data Dictionary main window. The Data Dictionary constructs (and executes) a
CONNECTstatement using the information you supply. Therefore, any rules that apply to theCONNECTstatement also apply to database connections using the Data Dictionary.Connecting with the Data Administration tool
You can also connect to a database during a Progress 4GL session using the Data Administration tool.
![]()
To connect to a database with the Data Administration tool:
- Open the Data Administration tool. The Data Administration main window appears:
![]()
- Choose Database
Connect. The Connect Database dialog box appears:
![]()
- Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
![]()
- Enter the following information, then choose OK:
- Physical Name — Specifies the actual name of the database on a disk.
- Logical Name — Specifies the database name that references a connected physical database.
- Database Type — Specifies the database type. The only possible value is PROGRESS.
- Network — Specifies the network type, if you are connecting to a network server. The only possible value is TCP.
- Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
- Host Name — Specifies the database server machine in a network environment.
- Service Name — Specifies the broker or server service name in a network environment.
- User ID — Identifies your user ID.
- Password — Identifies your password.
- Trigger Location — Identifies a directory or 4GL procedure library where trigger code is stored.
- Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
- Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
OpenEdge returns you to the Data Administration main window. The Data Administration tool constructs (and executes) a
CONNECTstatement using the information you supply. Therefore, any rules that apply to theCONNECTstatement also apply to database connections using the Data Administration tool.Connecting with auto-connect
The OpenEdge auto-connect feature allows you to connect to databases automatically as required during program execution. To perform an auto-connect operation, OpenEdge uses information stored in a primary database to connect to a secondary application database, before running compiled procedures that access the second database. The primary database (the one that contains the auto-connect information for one or more additional databases) must be connected before OpenEdge can perform an auto-connect.
Use the Data Administration tool to build an auto-connect list for a primary database.
![]()
To create or edit an auto-connect list:
If you connect to a database with the
CONNECTstatement, and that database also has an auto-connect entry in an already connected database, the connection information from both theCONNECTstatement and the auto-connect list is merged. In this situation, the connection information in theCONNECTstatement takes precedence. For more information about theCONNECTstatement, see OpenEdge Development: Progress 4GL Reference .If the primary database is a schema holder for a DataServer schema, the DataServer schema is automatically included in the auto-connect list, but it does not appear on the auto-connect list as viewed from the Data Dictionary.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |